<!doctype html>
<html>

<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <script type="text/javascript" src="qrc:///qtwebchannel/qwebchannel.js"></script>
    <script type="text/javascript">


        function output(message) {
            var output = document.getElementById("output");
            output.innerHTML += output.innerHTML + message + "<br>";
        }

        window.onload = function () {
            new QWebChannel(qt.webChannelTransport, function (channel) {

                var cppAndjavascript = channel.objects.cppAndjavascript;

                cppAndjavascript.msgChange.connect(function (message) {


                    console.log(message)
                    output(message)

                    cppAndjavascript.onCallMsg("call msg");

                });

            });
        }

    </script>
</head>

<body>
    <div id="output"></div>

</body>

</html>
